package elasticsearch;

import elasticsearch.util.EsSearchUtil;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
import elasticsearch.util.ESAdminClientUtil;

import java.net.InetAddress;


public class ElasticSearchTest {
	private static final String index = "index1";
	private static final String type = "type1";

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		TransportClient client = null;

		try {
			Settings settings = Settings.builder()
					.put("cluster.name", "my-application")
					.put("client.transport.ignore_cluster_name", true)
					.put("client.transport.sniff", true).build();

			client = new PreBuiltTransportClient(settings)
					.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("192.168.106.129"), 9300));

//			GetResponse response = EsGetUtil.getIndex(client,"1");
//			EsOperationIndexUtil.createIndex(client);
//			EsOperationIndexUtil.deleteIndex(client);
//			EsOperationIndexUtil.DeleteByQueryIndex(client);
//			EsOperationIndexUtil.UpdateIndex(client);
//			EsOperationIndexUtil.InsertUpdateIndex(client);
//			EsGetUtil.multiGetResponse(client);
//			EsGetUtil.buik(client);
			EsSearchUtil.range(client);
//			EsSearchUtil.scroll(client);
//			EsSearchUtil.multiSearch(client);
//			ESAdminClientUtil.createIndex(client);
//			ESAdminClientUtil.setType(client);
//			ESAdminClientUtil.refresh(client);
//			ESAdminClientUtil.getSetting(client);
//			ESAdminClientUtil.clusterHealth(client);
			client.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}




}
